package cn.codeforfun.controller;

import cn.codeforfun.util.PropUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;


@Controller
public class IndexController {
  private final Logger log = LoggerFactory.getLogger(this.getClass());

  @Resource
  private PropUtils propUtils;

  @RequestMapping
  @ResponseBody
  public String index() {
    log.debug("debug...");
    log.info("info...");
    System.out.println(propUtils.getAppId());
    return "hello, world";
  }

  @RequestMapping("/errortest")
  @ResponseBody
  public int error() {
    int i = 1 / 0;
    return i;
  }
}
